package com.tuweiya.study.springmvc002.eventBus.bus;

import com.google.common.eventbus.EventBus;

/**
 * @Author: Mr_tu
 * @Date: Create in 15:42 2018/6/7
 * @Description: 基于Guava EventBus 实现自定义的EventBus
 *      TimeEventBus类封装了guava原始EventBus的api，并通过static方法对外提供常用的消费发送、消息订阅、取消订阅等方法
 */
public class TimeEventBus {

//    private static String identifier = "timeEventBus";

    private final static EventBus timeEventBus = new EventBus();

    public static void post(Object event){
        timeEventBus.post(event);
    }

    public static void register(Object handler){
        timeEventBus.register(handler);
    }

    public static void unRegister(Object handler){
        timeEventBus.unregister(handler);
    }

    public static String identifier(){
        return timeEventBus.identifier();
    }

}
